<?php
$link = mysqli_connect("localhost","root","root","2113");

// 总的数据条数；
$sql = "SELECT COUNT(*) AS c FROM messages";

$res =  mysqli_query($link,$sql);

$one = mysqli_fetch_assoc($res);
// print_r($one);
$totalCount = $one['c'];  // 数据的总条数；

// 每页显示多少条 
$perPage = 5;

// 页码的总数；
$totalPage = ceil($totalCount / $perPage);
// echo $totalPage;
$arr['totalPage'] = $totalPage;
echo json_encode($arr);







?>